package com.example.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.example.tools.Result;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.domain.Guanzhu;
import com.example.service.IGuanzhuService;

/**
 * 用户信息Controller
 *
 * @author ruoyi
 * @date 2023-04-13
 */
@RestController
@RequestMapping("/system/guanzhu")
public class GuanzhuController
{
    @Autowired
    private IGuanzhuService guanzhuService;

    /**
     * 查询用户信息列表
     */

    @GetMapping("/list/{userid}")
    public Result list( @PathVariable(value = "userid",required = false)  Integer userid)
    {
        Guanzhu list = guanzhuService.selectGuanzhuByUserid(userid);
        return  Result.ok(list);
    }

    @GetMapping("/test/{userid}")
    public Result test( @PathVariable(value = "userid",required = false)  Integer userid)
    {
        Guanzhu list = guanzhuService.selectuserone(userid);
        return  Result.ok(list);
    }


//    /**
//     * 导出用户信息列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:guanzhu:export')")
//    @Log(title = "用户信息", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, Guanzhu guanzhu)
//    {
//        List<Guanzhu> list = guanzhuService.selectGuanzhuList(guanzhu);
//        ExcelUtil<Guanzhu> util = new ExcelUtil<Guanzhu>(Guanzhu.class);
//        util.exportExcel(response, list, "用户信息数据");
//    }
//
//    /**
//     * 获取用户信息详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:guanzhu:query')")
//    @GetMapping(value = "/{userid}")
//    public AjaxResult getInfo(@PathVariable("userid") Integer userid)
//    {
//        return success(guanzhuService.selectGuanzhuByUserid(userid));
//    }
//
//    /**
//     * 新增用户信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:guanzhu:add')")
//    @Log(title = "用户信息", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody Guanzhu guanzhu)
//    {
//        return toAjax(guanzhuService.insertGuanzhu(guanzhu));
//    }
//
//    /**
//     * 修改用户信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:guanzhu:edit')")
//    @Log(title = "用户信息", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody Guanzhu guanzhu)
//    {
//        return toAjax(guanzhuService.updateGuanzhu(guanzhu));
//    }
//
//    /**
//     * 删除用户信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:guanzhu:remove')")
//    @Log(title = "用户信息", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{userids}")
//    public AjaxResult remove(@PathVariable Integer[] userids)
//    {
//        return toAjax(guanzhuService.deleteGuanzhuByUserids(userids));
//    }
}
